# 子类重写父类的方法

class Parent:  
    def my_method(self):  
        print("This is the method in Parent class")  
  
class Child(Parent):  
    def my_method(self):  
        print("This is the method in Child class")  
  
# 创建 Parent 类的实例  
parent_instance = Parent()  
parent_instance.my_method()  # 输出: This is the method in Parent class  
  
# 创建 Child 类的实例  
child_instance = Child()  
child_instance.my_method()  # 输出: This is the method in Child class